PowerDesigner根据sql文件生成表模型 您所在的位置:网站首页 vscode 数据库脚本生成 PowerDesigner根据sql文件生成表模型

PowerDesigner根据sql文件生成表模型

2023-08-01 22:00| 来源: 网络整理| 查看: 265

经常要在PD中建表, 但是一个一个复制又比较无聊, 使用sql文件逆向生成

拼接建表语句, 利用程序+excel,+Editplus 很容易拼接出来(commen要加: 对应pd.table中name属性)

建表, 用PLSQL导出sql文件, tools–export user objects–选中表刚建的表–export

记事本打开导出的.sql文件 a. 将sql文件中表前面 表空间+"." 全部替换为空串 b. 另存为(解决中文乱码)

pdm建模型

在这里插入图片描述 在这里插入图片描述 在这里插入图片描述 在这里插入图片描述 此时name(左边)是英文 在这里插入图片描述

在这里插入图片描述

执行下面脚本, 将name改为comment内容, 点击Run

Option Explicit ValidationMode = True InteractiveMode = im_Batch

Dim mdl 'the current model

'get the current active model Set mdl = ActiveModel If (mdl Is Nothing) Then MsgBox “There is no current Model” ElseIf Not mdl.IsKindOf(PdPDM.cls_Model) Then MsgBox “The current model is not an Physical Data model.” Else ProcessFolder mdl End If

'This routine copy name into code for each table, each column and each view 'of the current folder Private sub ProcessFolder(folder)

Dim Tab 'running table for each Tab in folder.tables if not tab.isShortcut then if len(tab.comment) 0 then tab.name = tab.comment end if On Error Resume Next Dim col 'running column for each col in tab.columns if len(col.comment) 0 then col.name =col.comment end if On Error Resume Next next end if next end sub

改table背景颜色 在这里插入图片描述 在这里插入图片描述

在这里插入图片描述



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有